import axiosInstance from "../axiosInstance";

const adminInfo = {
    /**
     * 管理员登录验证
     * @param {{ zh, admin_pwd }} param0 
     * @returns {Promise<Object>}
     */
    checkLogin({ zh, admin_pwd }) {
        return axiosInstance.post("/adminInfo/checkLogin", {
            zh, admin_pwd
        })
    },
    /**
     * 分页获取管理员信息
     * @param {{ pageIndex, admin_name, admin_sex, admin_tel, admin_email }} param0 
     * @returns {Promise<Object>}
     */
    getListByPage({ pageIndex, admin_name, admin_sex, admin_tel, admin_email }) {
        return axiosInstance.get("/adminInfo/getListByPage", {
            params: {
                pageIndex, admin_name, admin_sex, admin_tel, admin_email
            }
        })
    },
    /**
     * 根据id删除管理员
     * @param {id} param0 
     * @returns {Promise<Object>}
     */
    deleteById(id) {
        return axiosInstance.get("/adminInfo/deleteById", {
            params: {
                id
            }
        })
    },
    /**
     * 根据id查找管理员信息
     * @param {id} id 
     * @returns {Promise<Object>}
     */
    findById(id) {
        return axiosInstance.get("/adminInfo/findById", {
            params: {
                id
            }
        })
    },
    /**
     * 更新管理员信息
     * @param {{id,admin_name, admin_sex, admin_tel, admin_email,admin_photo,admin_type}} param0 
     * @returns {Promise<Object>}
     */
    update({ id, admin_name, admin_sex, admin_tel, admin_email, admin_photo, admin_type }) {
        return axiosInstance.post("/adminInfo/update", {
            id, admin_name, admin_sex, admin_tel, admin_email, admin_photo, admin_type
        })
    },
    /**
     * 新增管理员信息
     * @param {{admin_name,admin_pwd, admin_sex, admin_tel, admin_email,admin_photo,admin_type}} param0 
     * @returns {Promise<Object>}
     */
    add({admin_name,admin_pwd, admin_sex, admin_tel, admin_email,admin_photo,admin_type}){
        return axiosInstance.post("/adminInfo/add",{
            admin_name,admin_pwd, admin_sex, admin_tel, admin_email,admin_photo,admin_type
        })
    },
    /**
     * 获取所有数据
     * @returns {Promise<Object>}
     */
    getTotalInfo(){
        return axiosInstance.get("/adminInfo/getTotalInfo");
    },
    /**
     * 获取全部分类信息
     * @returns {Promise<Object>}
     */
    getCategoryFoodCount(){
        return axiosInstance.get("/adminInfo/getCategoryFoodCount");
    }
}


export default adminInfo;